package org.jetnuke.common;

import org.apache.log4j.Logger;

import java.io.Serializable;
import java.util.HashMap;

public class UserBlockPref implements Serializable {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(UserBlockPref.class);

	public boolean isMinimized(int bid) {
		if (logger.isDebugEnabled()) {
			logger.debug("isMinimized(int) - start"); //$NON-NLS-1$
		}

		Boolean b = (Boolean) map.get(String.valueOf(bid));
		if (b == null)
			return false;
		boolean returnboolean = b.booleanValue();
		if (logger.isDebugEnabled()) {
			logger.debug("isMinimized(int) - end"); //$NON-NLS-1$
		}
		return returnboolean;
	}

	/**
	 * @param bid
	 */
	public void toggleVisibility(int bid) {
		if (logger.isDebugEnabled()) {
			logger.debug("toggleVisibility(int) - start"); //$NON-NLS-1$
		}

		String sbid = String.valueOf(bid);
		Boolean b = (Boolean) map.get(sbid);
		if (b == null) {
			map.put(sbid, Boolean.TRUE);
		} else {
			map.put(sbid, Boolean.valueOf(!b.booleanValue()));
		}

		if (logger.isDebugEnabled()) {
			logger.debug("toggleVisibility(int) - end"); //$NON-NLS-1$
		}
	}

	HashMap map = new HashMap();

}
